import { ApiProperty } from '@nestjs/swagger';
import { IsBoolean, IsNotEmpty, IsOptional, IsString } from 'class-validator';

export class UserEntity {
  id?: string;
  @ApiProperty({
    description: '用户名',
  })
  @IsString()
  @IsNotEmpty()
  username: string;
  @ApiProperty({
    description: '密码',
  })
  @IsString()
  @IsNotEmpty()
  password: string;

  @ApiProperty({
    description: '角色',
  })
  @IsString()
  @IsNotEmpty()
  roleId: string;

  iv?: string | null;
  key?: string | null;

  @ApiProperty({
    description: '联系电话',
    default: null,
  })
  @IsString()
  @IsOptional()
  mobile?: string | null;
  @ApiProperty({
    description: '邮箱',
    default: null,
  })
  @IsString()
  @IsOptional()
  email?: string | null;
  @ApiProperty({
    description: '是否禁用',
    default: false,
  })
  @IsBoolean()
  @IsOptional()
  disabled?: boolean;
  @ApiProperty({
    description: '备注',
    default: null,
  })
  @IsString()
  @IsOptional()
  remark?: string | null;

  loginStamp?: number | null;
  createdAt?: number | null;
  updatedAt?: number | null;
}
